package com.k136.config;

import com.k136.config.filter.BrandFilter;
import com.k136.entity.Brand;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;

/**
 * TODO 类
 *
 * @author LiuTai
 * @version 1.00
 * @Date 2024/9/2
 */
@Configuration
public class FilterConfig {
    @Bean(initMethod = "show" ,destroyMethod = "bye")
    public Brand xt(){
        Brand brand=new Brand();
        brand.setBrandId(8);
        brand.setBrandName("2");
        return brand;
    }
    @Bean
    public BrandFilter brandFilter(){
    BrandFilter bf =new BrandFilter();
    return bf;
    }
    @Bean
    public FilterRegistrationBean getfilterRegistrationBean(BrandFilter bf){
        FilterRegistrationBean filterBeans=new FilterRegistrationBean();
        filterBeans.setFilter(bf);
        filterBeans.setOrder(0);
        filterBeans.setUrlPatterns(Arrays.asList("/*"));
        filterBeans.setName("BrandFilter");
        return filterBeans;
    }
}